package leetcode_动态规划._01斐波那契数列;

/**
 * 爬楼梯
 */
public class _70 {

    public int climbStairs(int n) {
        if (n <= 2) {
            return n;
        }
        int a = 1, b = 2;
        for (int i = 3; i <= n; i++) {
            int tem = b;
            b = b + a;
            a = tem;
        }
        return b;
    }
}
